package com.xingbg.projectimpl.web.controllers;

import com.xingbg.projectimpl.provider.api.dto.ItemClass;
import com.xingbg.projectimpl.provider.api.service.TestDubboService;
import com.xingbg.projectimpl.provider.api.service.TestService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
//@ControllerOverride(CodeVersionEnum.Master)
@RestController
@RequestMapping("test")
public class TestController{

//    @Autowired(required = false)
    @Autowired(required = false)
    private TestService testService;

//    @DubboReference(check = false)

    @Autowired(required = false)
    private TestDubboService testDubboService;


    @GetMapping("/hello/{name}")
    public String hello(@PathVariable String name){

        return testService.sayHello(name);
    }

    @GetMapping("/dubbohello")
    public String dubbohello(String name){

        return testDubboService.dubboHello(name);
    }

    @GetMapping("/list")
    public List<ItemClass> getList(){
        return testService.getList();
    }


}
